Skip to content

Fix: Exclude not working with absolute path in some cases (#593)#618

Open
dqkqd wants to merge 1 commit intoKampfkarren:mainfrom
dqkqd:issue-593
Open

Fix: Exclude not working with absolute path in some cases (#593)#618
dqkqd wants to merge 1 commit intoKampfkarren:mainfrom
dqkqd:issue-593

Conversation

@dqkqd
Copy link

@dqkqd dqkqd commented Oct 12, 2024

Fix #593

Exclude sometimes doesn't work with absolute path because it tries to match the pattern directly with the path itself.

Since the exclude option is relative, the absolute path to lint should be converted to relative path as well.

exclude = ["**/file.lua"]
exclude = ["src/**"]
exclude = ["external/*", "*.spec.lua"]

For example, if we are in selene-test folder with the following exclude option:

exclude = ["src/**"]

Then, by converting this absolute path /path/to/selene-test/src/file.lua to src/file.lua, exclude can work properly.

The problem is which path we should relate to, initially I thought using config directory (where selene.toml lies) is a good place, but to keep it simple without unnecessary changes, I use the current directory (where selene is invoked) instead.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Exclude not working with absolute path in some cases

4 participants